<template>
    <div>
<h1>用户表格</h1>
<a href="/Add">新增</a>
<table>
    <thead>
        <tr>
            <td>ID</td>
            <td>姓名</td>
        </tr>
    </thead>
    <tbody>
        <tr v-for="a in list">
            <td>{{ a.id }}</td>
            <td>{{a.name}}</td>
        </tr>
    </tbody>
</table>
    </div>
</template>
<script setup lang="ts">
import { ref,onMounted } from 'vue';  
import axios from 'axios';
const list=ref([{
    "id": 0,
    "name": ""
  }]);

//“就绪函数”，网页一打开就调用API
onMounted(()=>{
    GetData();//Vue
})
//调用API[Vue框架的钩子函数其中一个]
const GetData=()=>{
    axios.get("https://localhost:7205/api/Member/GetMembers").then(res=>{
        // debugger    是javascript语言中的
        list.value = res.data;
    })
}
/* function GetData()
{

} */

</script>

<style scoped>

</style>